package picoevo.ext.evolution;

import java.util.ArrayList;

import picoevo.core.evolution.InitialisationOperator_Individual;
import picoevo.core.evolution.ParameterSet;
import picoevo.core.representation.Individual;
import picoevo.ext.representation.Element_StaticArray_Double;
import picoevo.ext.representation.Individual_SimpleIndividual;
import picoevo.toolbox.Display;

public class InitialisationOperator_Individual_StaticArray_Double extends InitialisationOperator_Individual {

	// ### Constructors ###

	public InitialisationOperator_Individual_StaticArray_Double() {
		super();
	}

	public InitialisationOperator_Individual_StaticArray_Double(String __name) {
		super(__name);
	}

	// ### Methods ###

	@Override
	public void initialise(Individual __o) {
		try {
			Individual_SimpleIndividual individual = (Individual_SimpleIndividual) __o;

			ArrayList OperatorList = new ArrayList();
			VariationOperator_Element_DoubleArray_UniformMutation op = new VariationOperator_Element_DoubleArray_UniformMutation("mutation1", (individual.getTemplate()).getDoubleProperty("MutationRate"));
			OperatorList.add(op);
			individual.addElement(new Element_StaticArray_Double("double array", individual, OperatorList, (individual.getTemplate()).getIntProperty("GenomeSize")));
			((Element_StaticArray_Double) individual.getElementAt(0)).performInitialisation();
		} catch (java.lang.ClassCastException e) {
			Display.error("" + this.getClass().getName() + "::initialise(.) - Class cast exception");
		}

	}

}
